import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("AppBar"),
          centerTitle: true,
          //左侧按钮
          leading: IconButton(
              icon: Icon(Icons.menu),
              onPressed: () {
                print('"menu');
              }),
          //右侧菜单
          actions: <Widget>[
            IconButton(
                icon: Icon(Icons.settings),
                // 长按提示文本
                tooltip: 'setting',
                onPressed: () {
                  print('设置');
                }),
            IconButton(
                icon: Icon(Icons.search),
                onPressed: () {
                  print('搜索');
                }),
          ],
        ),
        body: Text("AppBar"),
      ),
    );
  }
}
